<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="ApplicationSettings"
    targetNamespace="https://locult.codeplex.com/CultureInfo.xsd"
    elementFormDefault="qualified"
    xmlns="https://locult.codeplex.com/CultureInfo.xsd"
    xmlns:mstns="https://locult.codeplex.com/CultureInfo.xsd"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
>
  <!--
  This xsd defines a simple data structure for storing BCP 47 codes and their
  lanuage information posted, for example, here:
  https://msdn.microsoft.com/en-us/library/windows/apps/system.globalization.cultureinfo%28v=vs.105%29.aspx
  -->
  
  <!--
  Use this command line to generate a natching poco class with xsd
  (xsd.exe must be in your path to make this work):
  xsd "xsd "CultureInfo.xsd" /c /n:CultureInfoLib.XMLModels /out:"C:\Temp"
  
  Follow this entry to create the required code for reading and writing XML:
  http://blog.icanmakethiswork.io/2012/11/xsdxml-schema-generator-xsdexe-taking.html
  -->

  <!-- Define type of XML Tag: File (element) -->
  <xs:complexType name="CultureLanguage_TAG">
    <xs:sequence>
      <xs:element name="Path"  type="xs:string"  minOccurs="0" maxOccurs="1" />
      <xs:element name="Type"  type="xs:string"  minOccurs="0" maxOccurs="1" />
      <xs:element name="Comment"  type="xs:string"  minOccurs="0" maxOccurs="1" />
    </xs:sequence>

    <xs:attribute name="name" type="xs:string" use="required" />
    <xs:attribute name="language" type="xs:string" use="required" />

  </xs:complexType>

  <!-- Define type of XML Tag: Cultures (element) -->
  <xs:complexType name="Cultures_TAG">
    <xs:sequence>
      <xs:element name="CultureLanguage"  type="CultureLanguage_TAG" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
  </xs:complexType>

  <!-- Root tag of XML document -->
  <xs:element name="CultureInfo">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="Comment"  type="xs:string"  minOccurs="0" maxOccurs="1" />
        <xs:element name="Cultures"  type="Cultures_TAG" minOccurs="1" maxOccurs="unbounded" />
      </xs:sequence>

      <!-- Store the version of the program that was used to create this XML file -->
      <xs:attribute name="Version" use="required">
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <!--
            Version must start with a "1." and be followed by 2 digits
            seperated with points eg: "1.00.00"
            -->
            <xs:pattern value="1\.\d{2,2}\.\d{2,2}"/>
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
    </xs:complexType>

  </xs:element>
</xs:schema>
